import { createRouter, createWebHistory } from "vue-router";
import {
  Home,
  FileTrayStacked,
  Heart,
  Cloudy,
  Radio,
  VideocamSharp,
  Settings,
  Fitness,
  CodeWorking,
  PlayCircle,
} from "@vicons/ionicons5";
import HomeView from "@/views/PageHome.vue";
import PageMyList from "@/views/PageMyPlayList.vue";
import PageMyLocal from "@/views/PageMyLocal.vue";
import PagePlayer from "@/views/PagePlayer.vue";
import PageAbout from "@/views/PageAbout.vue";
import PageTest from "@/views/PageTest.vue";
import PageSettting from "@/views/PageSettting.vue";
import PageTool from "@/views/PageTool.vue";

// export var navGroup = [
//   { name: "我的音乐", key: "my" },
//   { name: "在线音乐", key: "online" },
//   { name: "设置", key: "app" },
// ];
export var navMap = [
  // {
  //   path: "/test",
  //   key: "test",
  //   component: PageTest,
  //   name: "测试页面",
  //   icon: Home,
  //   color: "",
  //   group: -1,
  //   type: null,
  // },
  // {
  //   path: "/",
  //   key: "home",
  //   component: HomeView,
  //   name: "首页",
  //   icon: Home,
  //   color: "#F29411FF",
  //   group: -1,
  //   type: null,
  // },
  {
    path: "/player",
    key: "player",
    component: PagePlayer,
    name: "播放器",
    icon: PlayCircle,
    color: "",
    group: -1,
    type: null,
  },
  {
    key: "divider-1",
    type: "divider",
  },
  {
    path: "/my-playlist",
    key: "my-playlist",
    component: PageMyList,
    name: "我的歌单",
    icon: Heart,
    color: "red",
    group: 0,
    type: null,
  },
  {
    path: "/my-localdir",
    key: "my-localdir",
    component: PageMyLocal,
    name: "本地源库",
    icon: FileTrayStacked,
    color: "green",
    group: 0,
    type: null,
  },
  {
    key: "divider-2",
    type: "divider",
  },
  {
    path: "/online-push",
    key: "online-push",
    component: PageAbout,
    name: "音乐推荐",
    icon: Cloudy,
    color: "#F29411FF",
    group: 1,
    type: null,
  },
  {
    path: "/online-fm",
    key: "online-fm",
    component: PageAbout,
    name: "在线FM",
    icon: Radio,
    color: "blue",
    group: 1,
    type: null,
  },
  {
    path: "/online-bili",
    key: "online-bili",
    component: PageAbout,
    name: "哔哩哔哩",
    icon: VideocamSharp,
    color: "#1D7EEEFF",
    group: 1,
    type: null,
  },
  {
    key: "divider-3",
    type: "divider",
  },
  {
    path: "/app-tool",
    key: "app-tool",
    component: PageTool,
    name: "工具",
    icon: CodeWorking,
    color: "",
    group: 2,
    type: null,
  },
  {
    path: "/app-setting",
    key: "app-setting",
    component: PageSettting,
    name: "设置",
    icon: Settings,
    color: "",
    group: 2,
    type: null,
  },
];

var route_builder = navMap
  .filter((item) => item.type === null)
  .map((item) => ({
    path: item.path,
    name: item.key,
    component: item.component,
    meta: {
      title: item.name,
    },
  }));
route_builder.push({
  path: "/",
  name: "home",
  redirect: "/player",
});

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: route_builder,
});

export default router;
